﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;

namespace EasyProp.Tests
{
    [TestFixture]
    public class EasyPropBuilderFixture
    {
        [Test]
        public void can_build_decorated_class()
        {
            Assert.IsTrue(EasyPropBuilder.CanBuild<DecoratedClass>());
        }

        [Test]
        public void can_not_build_undecorated_class()
        {
            Assert.IsFalse(EasyPropBuilder.CanBuild<UnDecoratedClass>());
        }

        [Test]
        public void should_build_with_constructor_parameters()
        {
            EasyPropBuilder builder = new EasyPropBuilder();
            ClassWithNonEmptyConstructor theObject = builder.Build<ClassWithNonEmptyConstructor>("Foo", 3);
            Assert.AreEqual("Foo", theObject.Foo);
            Assert.AreEqual(3, theObject.Bar);
        }

        [BeforePropertySetFilter(typeof(DoNothingFilter))]
        public class DecoratedClass
        {}

        public class UnDecoratedClass
        {}

        [BeforePropertySetFilter(typeof(DoNothingFilter))]
        public class ClassWithNonEmptyConstructor
        {
            public ClassWithNonEmptyConstructor(string foo, int bar)
            {
                Foo = foo; Bar = bar;
            }

            public readonly string Foo;
            public readonly int Bar;
        }
    }

}
